<template>
  <div class="window">
    <!--轮播图-->
    <div class="swiper-container">
      <div class="swiper-wrapper">
        <div class="swiper-slide"><img src="../../../assets/Gourment/haibaomianbao.png" alt=""></div>
        <div class="swiper-slide"><img src="../../../assets/Gourment/haibaomianbao.png" alt=""></div>
        <div class="swiper-slide"><img src="../../../assets/Gourment/haibaomianbao.png" alt=""></div>
      </div>
      <!-- 如果需要分页器 -->
      <div class="swiper-pagination"></div>
    </div>
    <div class="dayreco"></div>
    <!--热销类目-->
    <p class="meizhu"><span>——</span> 热销类目 <span>——</span></p>
    <div class="txing">
      <div>
        <router-link :to="{path: '/home'}"><img src="../../../assets/Gourment/tangguo.png" alt=""></router-link>
        <p>糖果</p>
      </div>
      <div>
        <router-link :to="{path: '/home'}"><img src="../../../assets/Gourment/penghua.png" alt=""></router-link>
        <p>膨化</p>
      </div>
      <div>
        <router-link :to="{path: '/home'}"><img src="../../../assets/Gourment/fangbianmian.png" alt=""></router-link>
        <p>方便面</p>
      </div>
      <div>
        <router-link :to="{path: '/home'}"><img src="../../../assets/Gourment/qiaokeli.png" alt=""></router-link>
        <p>巧克力</p>
      </div>
    </div>
    <div class="dayreco"></div>
    <!--爆品推荐-->
    <p class="meizhu"><span>——</span> 爆品推荐 <span>——</span></p>
    <ul class="uls">
      <li class="lis" v-for="item in isuls">
        <router-link :to="{name: 'product', params: {productImg: item.img, productPrice: 10, isPrice: item.price, isTxt: item.name, wid: item.ID}}">
          <img src="../../../assets/Gourment/baopin.png" alt="">
          <img :src="item.img" alt="">
          <p>{{item.name}}</p>
          <p>{{item.price}}</p>
        </router-link>
      </li>
    </ul>
    <!--亲, 就这么多了-->
    <div class="ponetin">亲, 就这么多了</div>
    <my-footer></my-footer>
  </div>
</template>
<script>
  import * as $ from 'jquery'
  import * as Swiper from 'swiper'
  import MyFooter from '../MyFooter/MyFooter.vue'
  import Vue from 'vue'
  export default {
    methods: {
      doGet() {
        Vue.axios.get('/goods/gourmet').then((res) => {
          this.isuls = res.data;
        })
      }
    },
    data() {
      return {
        isuls: []
      }
    },
    components: {
      MyFooter,
    },
    // 轮播图
    mounted() {
      new Swiper['default']('.swiper-container', {
        loop: true,
        autoplay:true,
        // 如果需要分页器
        pagination: {
          el: '.swiper-pagination',
        },
      });
      this.doGet();
    }
  }
</script>
<style scoped>
  @import "../../../../node_modules/swiper/dist/css/swiper.css";
  .swiper-container {
    font-size: 0;
  }
  .swiper-container img {
    width: 100%;
  }
  .dayreco {
    width: 100%;
    height: 1rem;
    background: rgb(242, 242, 242);
  }
  .meizhu {
    font-size: 1.5rem;
    text-align: center;
    font-weight: 300;
    margin-bottom: 0.5rem;
    border-top: 1px solid #cccccc;
    padding-top: 0.5rem;
  }
  .txing {
    display: flex;
    justify-content: space-around;
    text-align: center;
    border-bottom: 1px solid #cccccc;
    margin-top: 2.5rem;
  }
  .txing img {
    height: 6rem;
  }
  .txing p {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
  }
  .uls {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
  }
  .lis {
    width: 14.5rem;
    border: 1px solid #cccccc;
    text-align: center;
    position: relative;
    margin-bottom: 0.8rem;
  }
  .lis img:nth-child(1) {
    width: 2rem;
    position: absolute;
    top: 0;
    left: 0;
  }
  .lis img:nth-child(2) {
    height: 7rem;
  }
  .lis p:nth-child(3) {
    margin-top: 1rem;
    color: black;
    font-size: 1.2rem;
  }
  .lis p:nth-child(4) {
    margin-top: 0.3rem;
    color: red;
    font-size: 1.2rem;
  }
  .ponetin {
    margin-top: 1.5rem;
    font-size: 1rem;
    text-align: center;
    background: rgb(242, 242, 242);
    height: 2.5rem;
    line-height: 3rem;
    color: #cccccc;
    margin-bottom: 6rem;
  }
</style>
